SET NAMES utf8mb4;
SET
FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu`
(
    `id`          varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单ID',
    `title`       varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单名称',
    `permission`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci          DEFAULT NULL COMMENT '权限标识',
    `parent_id`   varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci          DEFAULT NULL COMMENT '父菜单ID',
    `sort`        int                                                    NOT NULL DEFAULT '0' COMMENT '排序值',
    `type`        char(1) CHARACTER SET utf8 COLLATE utf8_general_ci              DEFAULT NULL COMMENT '菜单类型 （0菜单 1按钮）',
    `create_time` timestamp                                              NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp                                              NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `del_flag`    char(1) CHARACTER SET utf8 COLLATE utf8_general_ci              DEFAULT '1' COMMENT '逻辑删除标记（1：显示；0：删除）',
    `icon`        varchar(255)                                                    DEFAULT NULL COMMENT '图标',
    `name`        varchar(32)                                                     DEFAULT NULL COMMENT '路由名称',
    `component`   varchar(255)                                                    DEFAULT NULL COMMENT 'vue页面路径',
    `path`        varchar(32)                                                     DEFAULT NULL COMMENT '前端路径',
    `hide`        char(1)                                                NOT NULL DEFAULT '1' COMMENT '0隐藏，1显示',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='菜单权限表';

-- ----------------------------
-- Records of sys_menu
-- ----------------------------
BEGIN;
INSERT INTO `sys_menu`
VALUES ('1596474720297943042', '系统管理', '', '0', 0, '0', '2022-11-26 20:03:29', '2022-12-08 15:50:53', '1',
        'icon-command', 'Sys', 'Layout', '/sys', '1');
INSERT INTO `sys_menu`
VALUES ('1596475035810267138', '用户新增', 'sys:user:add', '1600701494137491458', 0, '1', '2022-11-26 20:04:44',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475085537935362', '用户修改', 'sys:user:edit', '1600701494137491458', 0, '1', '2022-11-26 20:04:56',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475157935816705', '用户删除', 'sys:user:del', '1600701494137491458', 0, '1', '2022-11-26 20:05:13',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475251456212993', '角色删除', 'sys:role:del', '1600701643182084097', 0, '1', '2022-11-26 20:05:35',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475304971337729', '角色修改', 'sys:role:edit', '1600701643182084097', 0, '1', '2022-11-26 20:05:48',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475352400527361', '角色新增', 'sys:role:add', '1600701643182084097', 0, '1', '2022-11-26 20:05:59',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475541874016258', '角色查询', 'sys:role:get', '1600701643182084097', 0, '1', '2022-11-26 20:06:44',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475616125779970', '机构查询', 'sys:org:get', '1600701667353858050', 0, '1', '2022-11-26 20:07:02',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475674153975810', '机构新增', 'sys:org:add', '1600701667353858050', 0, '1', '2022-11-26 20:07:16',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475729451679745', '机构修改', 'sys:org:edit', '1600701667353858050', 0, '1', '2022-11-26 20:07:29',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475780269867009', '机构删除', 'sys:org:del', '1600701667353858050', 0, '1', '2022-11-26 20:07:41',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475852239929346', '菜单删除', 'sys:menu:del', '1600701607836684289', 0, '1', '2022-11-26 20:07:58',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475916828016641', '菜单新增', 'sys:menu:add', '1600701607836684289', 0, '1', '2022-11-26 20:08:14',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596475980703072257', '菜单修改', 'sys:menu:edit', '1600701607836684289', 0, '1', '2022-11-26 20:08:29',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1596476036441178113', '菜单查询', 'sys:menu:get', '1600701607836684289', 0, '1', '2022-11-26 20:08:42',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1600398155436859394', '用户查询', 'sys:user:get', '1600701494137491458', 0, '1', '2022-12-07 15:53:49',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1600398230812696577', '用户分页', 'sys:user:page', '1600701494137491458', 0, '1', '2022-12-07 15:54:06',
        '2022-12-08 12:11:27', '1', NULL, NULL, NULL, NULL, '1');
INSERT INTO `sys_menu`
VALUES ('1600701494137491458', '用户管理', '', '1596474720297943042', 0, '0', '2022-12-08 11:59:10',
        '2022-12-08 15:50:58', '1', 'icon-user', 'User', 'views/upms/user/index', 'user', '1');
INSERT INTO `sys_menu`
VALUES ('1600701607836684289', '菜单管理', '', '1596474720297943042', 0, '0', '2022-12-08 11:59:37',
        '2022-12-08 15:51:03', '1', 'icon-nav', 'Menu', 'views/upms/menu/index', 'menu', '1');
INSERT INTO `sys_menu`
VALUES ('1600701643182084097', '角色管理', '', '1596474720297943042', 0, '0', '2022-12-08 11:59:45',
        '2022-12-08 15:51:06', '1', 'icon-idcard', 'Role', 'views/upms/role/index', 'role', '1');
INSERT INTO `sys_menu`
VALUES ('1600701667353858050', '机构管理', '', '1596474720297943042', 0, '0', '2022-12-08 11:59:51',
        '2022-12-08 15:51:09', '1', 'icon-archive', 'Org', 'views/upms/org/index', 'org', '1');
COMMIT;

-- ----------------------------
-- Table structure for sys_org
-- ----------------------------
DROP TABLE IF EXISTS `sys_org`;
CREATE TABLE `sys_org`
(
    `id`          varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
    `parent_id`   varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci        DEFAULT NULL,
    `sort`        int                                                           DEFAULT '1' COMMENT '排序',
    `type`        char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci     NOT NULL COMMENT '机构类型',
    `code`        varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '机构编码',
    `name`        varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci        DEFAULT NULL COMMENT '机构名称',
    `phone`       varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci  DEFAULT NULL COMMENT '电话',
    `email`       varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci  DEFAULT NULL COMMENT '邮箱',
    `address`     varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '地址',
    `remarks`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
    `del_flag`    char(1) CHARACTER SET utf8 COLLATE utf8_general_ci            DEFAULT '1' COMMENT '逻辑删除标记（1：显示；0：删除）',
    `status`      char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci      DEFAULT NULL COMMENT '1:正常，0:锁定',
    `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='机构管理';

-- ----------------------------
-- Records of sys_org
-- ----------------------------
BEGIN;
INSERT INTO `sys_org`
VALUES ('1596473768090271745', '0', 1, '1', 'FBI', '神盾局', NULL, NULL, NULL, NULL, '1', NULL, '2022-11-26 19:59:42',
        NULL);
COMMIT;

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role`
(
    `id`          varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '主键',
    `role_name`   varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '角色名',
    `role_code`   varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '角色编码',
    `role_desc`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin         DEFAULT NULL COMMENT '角色描述',
    `create_time` timestamp                                             NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `del_flag`    char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin              DEFAULT '1' COMMENT '逻辑删除标记（1：显示；0：删除）',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE KEY `role_id_role_code` (`role_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='系统角色表';

-- ----------------------------
-- Records of sys_role
-- ----------------------------
BEGIN;
INSERT INTO `sys_role`
VALUES ('1596474199298277377', '超级管理员', 'admin', NULL, '2022-11-26 20:01:24', NULL, '1');
COMMIT;

-- ----------------------------
-- Table structure for sys_role_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_menu`;
CREATE TABLE `sys_role_menu`
(
    `role_id`     varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色ID',
    `menu_id`     varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单ID',
    `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`role_id`, `menu_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='角色菜单表';

-- ----------------------------
-- Records of sys_role_menu
-- ----------------------------
BEGIN;
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596474720297943042', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475035810267138', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475085537935362', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475157935816705', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475251456212993', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475304971337729', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475352400527361', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475541874016258', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475616125779970', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475674153975810', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475729451679745', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475780269867009', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475852239929346', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475916828016641', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596475980703072257', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1596476036441178113', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1600398155436859394', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1600398230812696577', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1600701494137491458', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1600701607836684289', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1600701643182084097', '2022-12-08 12:02:29');
INSERT INTO `sys_role_menu`
VALUES ('1596474199298277377', '1600701667353858050', '2022-12-08 12:02:29');
COMMIT;

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user`
(
    `id`          varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin  NOT NULL COMMENT '主键ID',
    `username`    varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin  NOT NULL COMMENT '用户名',
    `password`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    `phone`       varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin  DEFAULT NULL COMMENT '电话',
    `avatar`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '头像',
    `org_id`      varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin  DEFAULT NULL COMMENT '机构ID',
    `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `status`      char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin      DEFAULT '1' COMMENT '1-正常，0-锁定',
    `del_flag`    char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin      DEFAULT '1' COMMENT '逻辑删除标记（1：显示；0：删除）',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE KEY `uk_username` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='用户表';

-- ----------------------------
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user`
VALUES ('1593799491338035202', 'test', '$2a$10$Vh1AKiAJRj6Ke4YRLYreSOd3L.NxoxQ0jsemeNeBg.1RsUS.KIJXm', '', '', NULL,
        '2022-11-25 16:37:41', '2022-11-25 16:37:50', '1', '1');
INSERT INTO `sys_user`
VALUES ('1596481041667735553', 'admin', '$2a$10$P8ZcDdri1dnHd3NQBYDdHOYcTZtKxNYB.WliL/nMf5mCKpYY9Shhm', NULL, NULL,
        NULL, '2022-11-26 20:28:36', '2022-11-26 20:28:36', '1', '1');
COMMIT;

-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role`
(
    `user_id`     varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户ID',
    `role_id`     varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色ID',
    `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`user_id`, `role_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='用户角色表';

-- ----------------------------
-- Records of sys_user_role
-- ----------------------------
BEGIN;
INSERT INTO `sys_user_role`
VALUES ('1593799491338035202', '1596474199298277377', '2022-11-26 20:18:58');
COMMIT;

SET
FOREIGN_KEY_CHECKS = 1;
